<%@ page language="java" import="com.litt.core.common.*,com.gouwudai.gobbs.service.IUserService,com.gouwudai.gobbs.vo.UserLoginVO,com.litt.core.exception.NotLoginException" pageEncoding="UTF-8"%>
<%
response.setHeader("Pragma","No-cache");//HTTP 1.1
response.setHeader("Cache-Control","no-cache");//HTTP 1.0
response.setHeader("Expires","0");//防止被proxy

//定义属性供页面直接调用
Integer USER_ID = new Integer(0);
String LOGIN_ID = "";
String USER_NAME = "";

UserLoginVO userLogin = (UserLoginVO)session.getAttribute("USER_LOGIN");
if(userLogin==null)
{
	IUserService userService = (IUserService)BeanManager.getBean("userService");
	try
	{		
		userLogin = userService.userLogin(request.getCookies(),request.getRemoteAddr());	
		session.setAttribute("USER_LOGIN",userLogin);
		USER_ID = userLogin.getUserId();
		LOGIN_ID = userLogin.getLoginId();
		USER_NAME = userLogin.getUserName();		
	}
	catch(NotLoginException e)
	{
		//如果没有登陆，默认为游客身份		
		userLogin = userService.visitorLogin(request.getRemoteAddr());	
		session.setAttribute("USER_LOGIN",userLogin);
		LOGIN_ID = userLogin.getLoginId();
		USER_NAME = userLogin.getUserName();
	}
}
else
{
	USER_ID = userLogin.getUserId();
	LOGIN_ID = userLogin.getLoginId();
	USER_NAME = userLogin.getUserName();
}
%>

